package com.company.controller;

import com.company.model.GoodsType;
import com.company.service.GoodsTypeService;
import com.company.utils.MessageResponse;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/goodstype")
public class GoodsTypeController {
    @GetMapping
    public List<GoodsType> findAll() {
        return GoodsTypeService.findAll();
    }

    @PostMapping
    public MessageResponse<Boolean> insertOne(@RequestBody GoodsType type) {
        return GoodsTypeService.insertOne(type);
    }

    @DeleteMapping
    public MessageResponse<Boolean> deleteOne(int id) {
        return GoodsTypeService.deleteOne(id);
    }

    @PutMapping
    public MessageResponse<Boolean> updateOne(@RequestBody GoodsType type) {
        return GoodsTypeService.updateOne(type);
    }
}
